package com.foreknow.demo7;

/**
 * 每个类都会有一个默认的构造方法。如果显示的定义的构造方法，默认的构造方法就失效了。
 * this表示的是当前类对象自身。this.name表示类对象中的属性
 */
public class Constructor {
    String name;
    int age;
    String school;

    public Constructor(String name,int age,String school) {
        this.name = name;
        this.age = age;
        this.school = school;
    }

    public static void main(String[] args) {
        Constructor constructor = new Constructor("fender",30,"foreknow");
        System.out.println(constructor.name);
        System.out.println(constructor.age);
        System.out.println(constructor.school);
    }
}
